<template>
  <div>
    <ComTable
      @handleCurrentChange="handleCurrentChange"
      @handleSizeChange="handleSizeChange"
      :config="config"
      :pagination="{
        total: pageing.total,
        pageNum: pageing.pageNum,
        pageSize: pageing.pageSize,
      }"
      :list="getinformationlistable"
      :modes="consumptionModes"
    >
     <el-table-column
        label="注册时间"
        prop="createTime"
        >
        <template slot-scope="scope">
          <el-popover placement="top-start" trigger="hover" :content="scope.row.createTime" v-if="scope.row.createTime">
            <p slot="reference">
              {{ getTime(scope.row.createTime) }}
            </p>
          </el-popover>
        </template>
      </el-table-column>
       <el-table-column
        label="加入该问圈时间"
        prop="joinTime"
        >
        <template slot-scope="scope">
          <el-popover placement="top-start" trigger="hover" :content="scope.row.joinTime" v-if="scope.row.joinTime">
            <p slot="reference">
              {{ getTime(scope.row.joinTime) }}
            </p>
          </el-popover>
        </template>
      </el-table-column>
    </ComTable>
  </div>
</template>
<script>
import ComTable from "@/wss/components/comTable.vue";
import Comdrawer from "@/wss/components/Comdrawer.vue";
import { getinformationlist } from "@/wss/newApi_3-24/askAround/index";


export default {
  name: "Information",
  // props: ["getinformationlistable"],
  components: { ComTable, Comdrawer },
  data() {
    return {
      // 表格配置
      config: {
        // border: true,
        isAdd: false,
        loading: false,
      },

      //圈原信息
      consumptionModes: [
          {
          label: "手机号",
          mode: "phonenumber",
          showOverflowTooltip: true,
        },
        {
          label: "用户姓名",
          mode: "nickname",
          showOverflowTooltip: true,
        },
        {
          label: "职务",
          mode: "postion",
          showOverflowTooltip: true,
        },
      
        {
          label: "邮箱",
          mode: "email",
          showOverflowTooltip: true,
        },

        {
          label: "用户标签",
          mode: "label",
          showOverflowTooltip: true,
        },
        // {
        //   label: "注册时间",
        //   mode: "createTime",
        //   showOverflowTooltip: true,
        // },
        // {
        //   width: 110,
        //   label: "加入该问圈时间",
        //   mode: "joinTime",
        //   showOverflowTooltip: true,
        // },
      ],
      //圈员信息
        getinformationlistable: [],
      // 问圈ID
      masetrid: "",
      // 父主键传过来搜索参数
      seachdata: {},
      // 分页参数
      pageing: { pageNum: 1, pageSize: 10, total: 0 },
      //编辑抽屉是否弹出
    };
  },
  mounted(){
      // 获取父组件传过来的搜索参数
    this.$bus.$off("SeachInformation");
    this.$bus.$on("SeachInformation", (item) => {
      this.seachdata = item;
      this.getinformationlistfn(item);
    });
  },
  methods: {
        //查询列表
    async Informationlist(val) {
      console.log(val, "圈員信息");
      this.masetrid = val;
      await this.getinformationlistfn();
    },
    
     async getinformationlistfn(data) {
      let newdata = {
        type: "1",
        circleId: this.masetrid,
        nickname: data && data.nickname,
        phonenumber: data && data.phonenumber,
        pageNum:this.pageing.pageNum,
        pageSize:this.pageing.pageSize
      };
      let { code, rows,total } = await getinformationlist(newdata);
      if (code == 200) {
        this.pageing.total=total
        this.getinformationlistable = rows;
      }
    },
    //时间格式处理
      getTime(days) {
      let time = days.split(" ")[0]
      let arr = time.split("-");
      return arr[0].slice(2) + arr[1] + arr[2];
    },
   handleCurrentChange(pageNum) {
      this.pageing.pageNum = pageNum;
      this.getinformationlistfn(this.seachdata);
    },
    // 页容量发生改变
    handleSizeChange(pageSize) {
      this.pageing.pageSize = pageSize;
      this.getinformationlistfn(this.seachdata);
    },
  },
};
</script>

<style>
</style>